<?php

namespace UFSW\FeedBackBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class FeedBackController extends Controller
{
    public function inicioFeedBackAction()
    {
        return $this->render('FeedBackBundle:FeedBack:inicioFeedBack.html.twig');
    }
    
    public function feedBackFormAction()
    {
        return $this->render('FeedBackBundle:FeedBack:feedBackForm.html.twig');
    }
    
    public function sendEmailAction()
    {
        
        $peticion = $this->getRequest();
        $nombre = $peticion->get('nombre'); 
        $mail = $peticion->get('mail');
        $contenido = $peticion->get('contenido');
        $asunto =$peticion->get('asunto');
        
        
        $message = \Swift_Message::newInstance()
            ->setSubject($asunto)
            ->setFrom($mail)
            ->setTo('fabioarmando000@gmail.com')
            ->setBody(
                $this->renderView(
                    'FeedBackBundle:Feedback:email.txt.twig', array(
                        'nombre' => $nombre,
                        'contenido' => $contenido,)
            ));

        $this->get('mailer')-> send($message);

        return $this->render('FeedBackBundle:FeedBack:inicioFeedBack.html.twig');
    }
  
    
}
